// 加载 utils/uitls.js
import './utils/utils'
// 引入http发请求
import "./utils/http";
// app.js
App({
  globalData: {},
  onLaunch() {
    this.getToken()
  },
  getToken() {
    this.token = wx.getStorageSync('token');
    // 存了两个token，取数据时要记得全部取出来
    this.refresh_token = wx.getStorageSync('refresh_token')
  },
  setToken(token, refresh_token) {
    // 全局保存
    this.token = "Bearer " + token
    this.refresh_token = 'Bearer ' + refresh_token
    // 持久化 保存到本地存储
    wx.setStorageSync('token', this.token)
    wx.setStorageSync('refresh_token', this.refresh_token)
  }
})
